/***********************************************************************
 SlateInfo.h - Declare class to parse the slate info XML file and hold
 	the information within.

 Copyright (c) 2006 by Pixel Corps.  This program may be used under
 the terms of the X11 license, a copy of which should have accompanied
 this program, in the LICENSE file.
***********************************************************************/

#if !defined(SLATEGEN_SLATEINFO_H)
#define SLATEGEN_SLATEINFO_H

#include <expat.h>

#include <map>
#include <stack>
#include <string>
#include <vector>

class SlateInfo
{
public:
	//// Public interface
	// Ctor and dtor
	SlateInfo(const char* filename);
	~SlateInfo();

	// Return name of XML file
	const char* FileName() const { return sFileName_.c_str(); } 

	// Return the key info found in the XML file
	const char* GetArtist() const;
	const char* GetDate() const;
	const char* GetElement() const;
	const char* GetFirstFile() const;
	const char* GetNotes() const;
	const char* GetProject() const;
	const char* GetScene() const;

	// Miscellaneous functions
	void DumpDoc();
	void TrimAllWS();

	// XML callback handlers
	void StartElement(const char* pcElement);
	void EndElement(const char* pcElement);
	void SetChars(const char* pcText, int nLen);

protected:
	//// Internal support functions
	void Indent();
	void TrimWS(std::string& s);

private:
	//// Internal data
	std::string sFileName_;
	std::stack<std::string> ElementStack_;
	XML_Parser parser_;
	mutable std::map<std::string, std::string> DocData_;
	std::vector<std::string> LocalPaths_;
	std::vector<std::string> RemotePaths_;
};

#endif // !defined(SLATEGEN_SLATEINFO_H)

